package main

// gin framework 引入
import "github.com/gin-gonic/gin"
import "net/http"

// https://gin-gonic.com/zh-cn/docs/quickstart/
/**
运行之后查看localhost:8082/ping返回message
*/
func main() {
	port := "8082"
	r := gin.Default()
	r.GET("/ping", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "pong",
		})
	})
	r.GET("", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{
			"index": true,
		})
	})
	r.Run(":" + port)
}
